<!DOCTYPE html>
<script src="../../../../resources/testharness.js"></script>
<script src="../../../../resources/testharnessreport.js"></script>
<input id="input1" type="input">
<input id="input2" type="input">
<script>
test(function(t)
{
    var successInput = false;
    if (!window.eventSender)
        return;
    var input = document.getElementById('input1');
    input.focus();

    textInputController.setMarkedText('abcde', 1, 3);
    assert_true(textInputController.hasMarkedText());
    assert_equals(textInputController.markedRange().toString(), "0,5");

    var input2 = document.getElementById('input2');
    input2.addEventListener('input', function () {
        successInput = true;
    });
    var x = input2.offsetLeft + input2.offsetWidth / 2;
    var y = input2.offsetTop + input2.offsetHeight / 2;
    eventSender.gestureTapDown(x, y);
    eventSender.gestureShowPress(x, y);
    eventSender.gestureTap(x, y);

    eventSender.keyDown('a');
    assert_true(successInput);
}, "This tests if the composition is reset before tapping of gesture.");
</script>
